import React, { useRef } from 'react';
import { connect } from 'umi';

import { PageHeaderWrapper } from '@ant-design/pro-layout';
import Table from './components/Table';
import RuleModal from './components/RuleModal';

const RoleRule = () => {
  const ruleModelRef = useRef({});

  const openRuleModal = id => {
    ruleModelRef.current.showModal(id);
  };
  return (
    <PageHeaderWrapper>
      <Table openRuleModal={openRuleModal} />
      <RuleModal actionRef={ruleModelRef} />
    </PageHeaderWrapper>
  );
};

export default connect(({ smRoleRule }) => ({
  smRoleRule,
}))(RoleRule);
